def tribo_cond_df(file_no):
if file_no<=9:
filename = 'Results/CSV/PUEG4/PV_Limite_00{}.csv'.format(file_no)
else:
filename = 'Results/CSV/PUEG4/PV_Limite_0{}.csv'.format(file_no)
df1 = pd.read_csv(filename, header = 17, skiprows = [21])
if file_no<=9:
filename = 'Results/Chronoamperometry/PUEG4_recip_0{}.csv'.format(file_no)
else:
filename = 'Results/Chronoamperometry/PUEG4_recip_{}.csv'.format(file_no)
df2 = pd.read_csv(filename, header = 4)
df1 = df1[['T','COF']]
df2.columns = ['T','i']
df1['COF1000'] = df1.COF.rolling(1000).mean()
df2['i10'] = df2.i.rolling(10).mean()
return df1,df2,file_no
def plot_tribo_cond(df1,df2,file_no):
fig = make_subplots(specs=[[{"secondary_y": True}]])
fig.add_trace(go.Scattergl(
x=df2['T'], y=df2['i'],
name='Corrente',
mode='lines',
marker_color='rgba(152, 0, 0, .8)'
),
secondary_y=False,
)
fig.add_trace(go.Scattergl(
x=df1['T'], y=df1['COF'],
name='COF',
mode='lines',
marker_color='rgba(0, 0, 152, .8)'
),
secondary_y=True)
fig.update_xaxes(range = [705,706])
fig.update_yaxes(title_text = 'Corrente (µA)', color = 'rgba(152, 0, 0, .8)', range=[-0.0006,0.0006], secondary_y = False)
fig.update_yaxes(title_text = 'Coeficiente de Atrito (-)', color = 'rgba(0, 0, 152, .8)', range=[-0.5,0.5], secondary_y = True)
fig.update_layout(title_text = 'PUEG4 - Ensaio {}'.format(file_no))
#df = pd.merge(df1[['T','COF']],df2[['T','i']], on = 'T')
# fig2 = px.density_heatmap(x=df.loc[df['T']>10,"COF"],
# y=df.loc[df['T']>10,"i"],
# marginal_x="histogram",
# marginal_y="histogram"
# )
#fig3 = px.scatter(df2[df2['T']>10], x = 'T', y='i', trendline = 'lowess')
return fig